The "advanced" usage of the PHP switch judgment statement is detailed in the switch
Only so called "advanced" usage, because I even switch the most basic usage has not mastered, so, the next is actually the basic usage of it!
A switch statement is
Example of a switch statement in PHP, Phpswitch statement
Switch is a switching statement, so many friends only know the simple switch switch statement usage, the following tutorial small series for you to introduce the switch usage example.
Only
In the process of PHP web development, the speed of the website is closely related to the simplicity and complexity of the code. For example, when we need to specify a variety of conditions to execute different blocks of code, it is necessary to use
We have explained a multi-choice elseif statement. Although this statement can be used for multiple judgments, many if statements need to be written during use, which makes the readability of our program inconvenient, to avoid too many if statements
a more comprehensive set of PHP tutorials , basic video and some small combat projects, below is the video directoryCD-ROM (i) \php employment Class (I.)CD-ROM (i) \php Technical exchange zone. URLCD-ROM (i) \ "Wisdom Special issue" belongs to it
Let's talk about the format of the switch () statement
switch (expression) {
Case Match 1:
When matching 1 and the expression match the successful execution of the Code;
Break
Case Match 2:
When matching 2 and the expression match the successful
Switch statements in PHP are used to perform different actions based on multiple different conditions. If you want to selectively execute one of several blocks of code, use a Switch statement.
Switch syntax
The code is as follows
The switch statement executes one line at a line (actually a statement-taking statement), and here's how multiple values for PHP switch statements match the same code block Let's talk about the format of the switch () statement switch
The switch statement is used to perform different actions based on different conditions. Here are some knowledge points for switch usage, and friends who are interested in switch usage learn through this article.
Switch is a toggle statement,
switch
First, let's talk about the format of the switch () statement.Switch (expression ){Case match 1:Code that is successfully executed when match 1 and expression match;Break;Case matching 2:Code that is successfully executed when matching 2 and
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.